<template>
  <div id="module">
    <el-container>
      <!-- 左侧导航 -->
      <NavMenu />
      <el-container>
        <!-- 右侧-头部 -->
        <el-header>
          Header
          <el-button type="primary" class="exit" @click="logout">退出</el-button>
        </el-header>
        <!-- 右侧-主体 -->
        <el-main>
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup>
import { removeToken } from "@/utils/auth";
import NavMenu from "./navMenu.vue";
import { useRouter } from "vue-router";
import { useMainStore } from "@/store/main";

const $router = useRouter();
const mainStrore = useMainStore();
const logout = () => {
  removeToken();
  mainStrore.clearNav();
  $router.push("/login");
};
</script>
